bool isValid(char* s) {
    ST st;
    STInit(&st);
    char topVal;
    while (*s)
    {
        if (*s == '(' || *s == '[' || *s == '{')
        {
            STPush(&st, *s);
        }
        else
        {
            if (STEmpty(&st))
            {
                STDestory(&st);
                return false;
            }
            topVal = STTop(&st);
            STPop(&st);
            if ((*s == ')' && topVal != '(') || (*s == ']' && topVal != '[') || (*s == '}' && topVal != '{'))
            {
                STDestory(&st);
                return false;

            }
        }
        ++s;
    }

    bool ret = STEmpty(&st);
    STDestory(&st);
    return ret;
}